from django.db import models

# Create your models here.
from users.models import User


class Resume(models.Model):
    """简历模型类"""
    user = models.ForeignKey(User, verbose_name='用户id')
    real_name = models.CharField(max_length=20, verbose_name='真实姓名', null=True)
    gender = models.CharField(max_length=2, verbose_name='性别', null=True)
    birth_date = models.DateField(verbose_name="生日", null=True)
    personal_url = models.CharField(max_length=100, verbose_name='个人网址', null=True)
    mobile = models.CharField(max_length=11, unique=True, verbose_name='手机号', null=True)
    email = models.CharField(max_length=20, unique=True, verbose_name='邮箱', null=True)
    now_city = models.CharField(max_length=20, verbose_name='现居城市', null=True)
    contact_address = models.CharField(max_length=40, verbose_name='通讯地址', null=True)
    progress = models.IntegerField(verbose_name='进度', default=0)
    avatar_url = models.CharField(max_length=100, verbose_name='头像地址', null=True)
    school = models.CharField(max_length=100, verbose_name='毕业学校', null=True)
    city = models.CharField(max_length=100, verbose_name='城市', null=True)
    company = models.CharField(max_length=100, verbose_name='公司', null=True)
    is_delete = models.IntegerField(verbose_name='该简历是否删除', default=0)

    class Meta:
        db_table = 'tb_resume'
        verbose_name = '简历'
        verbose_name_plural = verbose_name


class ResumeWorkExperiences(models.Model):
    """
    用户工作经历模型类
    """
    resume_id = models.ForeignKey(Resume, verbose_name='简历id')
    introduction = models.CharField(max_length=200, verbose_name='个人介绍')
    company = models.CharField(max_length=40, verbose_name='公司')
    position = models.CharField(max_length=20, verbose_name="职位")
    start_date = models.DateTimeField(max_length=6, verbose_name='开始日期')
    end_date = models.DateTimeField(max_length=6, verbose_name='结束日期')
    job_content = models.CharField(max_length=1000, verbose_name='工作经历')
    is_delete = models.IntegerField(verbose_name='该经历是否删除', default=0)

    class Meta:
        db_table = 'tb_resume_ work_experiences'
        verbose_name = '工作经历'
        verbose_name_plural = verbose_name


class ResumeEducationExperiences(models.Model):
    """
    用户教育经历模型类
    """
    resume_id = models.ForeignKey(Resume, verbose_name='简历id')
    school = models.CharField(max_length=20, verbose_name='学校')
    major = models.CharField(max_length=25, verbose_name='专业')
    start_date = models.DateTimeField(max_length=6, verbose_name='开始日期')
    end_date = models.DateTimeField(max_length=6, verbose_name='结束日期')
    edu_content = models.CharField(max_length=1000, verbose_name='教育经历')
    is_delete = models.IntegerField(verbose_name='该经历是否删除', default=0)

    class Meta:
        db_table = 'tb_resume_education_experience'
        verbose_name = '教育经历'
        verbose_name_plural = verbose_name


class ResumeTechnologyStack(models.Model):
    """
    用户技术栈关系模型类
    """
    resume_id = models.ForeignKey(Resume, verbose_name='简历id')
    # ts_id = models.ForeignKey(,verbose_name='技术栈id')

    class Meta:
        db_table = 'tb_resume_technology_stack'
        verbose_name = '技术栈关系'
        verbose_name_plural = verbose_name